home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / asm_n_z.zip / SCROLLER.ASM < prev    next >
Assembly Source File  |  1986-05-07  |  3KB  |  99 lines

  1. ; Resident program to provide flicker-free write_tty scroll for Color
  2. ;  Graphics Adapter clones with dual-ported memory.  M. Abrash 5/3/86.
  3. ; Make runnable with MASM-LINK-EXE2BIN.
  4. cseg    segment
  5.     assume    cs:cseg
  6.     org    100h    ;necessary for COM file
  7. start    proc    near
  8.     jmp    makeres
  9. old_int10    dd    ?
  10. ; front end routine for BIOS video handler to scroll without flicker
  11. scroll_front_end:
  12.     cmp    ax,0e0ah    ;only intercept write_tty function
  13.     jnz    pass_to_bios    ; called with linefeed
  14.     push    ax
  15.     push    bx
  16.     mov    ah,0fh
  17.     int    10h        ;get current page & mode
  18.     cmp    al,2
  19.     jz    check_row    ;BIOS only blanks in modes 2 & 3, so
  20.     cmp    al,3        ; only intercept linefeed scroll in
  21.     jnz    pass_to_bios2    ; modes 2 & 3
  22. check_row:            ;see if cursor is on bottom row, in
  23.     push    cx        ; which case linefeed causes scroll
  24.     push    dx
  25.     mov    ah,3
  26.     int    10h        ;get cursor location in current page
  27.     cmp    dh,24
  28.     jnz    pass_to_bios3    ;cursor not on bottom row, no scroll
  29.     push    ds        ;meets all the criteria, so perform
  30.     push    es        ; scroll in current page with special
  31.     push    si        ; routine that doesn't disable video
  32.     push    di
  33.     mov    ah,0fh
  34.     int    10h        ;get # columns & page
  35.     mov    al,ah
  36.     sub    ah,ah    ;convert to word    
  37.     push    ax    ;set aside # columns
  38.     mov    si,ax
  39.     shl    si,1    ;move from second row (each character=2 bytes)
  40.     mov    ah,24
  41.     mul    ah    ;# words to move (24 rows)
  42.     mov    cx,ax
  43.     sub    ax,ax    ;now adjust offsets for current page
  44.     mov    ds,ax    ;buffer length is stored in BIOS segment
  45.     mov    al,bh    ;get current page
  46.     mul    word ptr ds:[44ch] ;offset of start of current page
  47.     add    si,ax    ;move data from second row of current page
  48.     mov    di,ax    ; to top of current page
  49.     mov    ax,0b800h
  50.     mov    ds,ax
  51.     mov    es,ax        ;will move data in display segment
  52.     cld
  53.     rep movsw        ;scroll screen up
  54.     mov    ah,8    ;BH already has current page
  55.     int    10h    ;get attribute of character at cursor
  56.     mov    al,' '    ;fill with blanks & attribute just obtained
  57.     pop    cx    ;# of words per row
  58.     rep    stosw        ;blank bottom row-DI points to bottom row
  59.     pop    di    ;done
  60.     pop    si
  61.     pop    es
  62.     pop    ds
  63.     pop    dx
  64.     pop    cx
  65.     pop    bx
  66.     pop    ax
  67.     iret
  68. pass_to_bios3:
  69.     pop    dx
  70.     pop    cx
  71. pass_to_bios2:
  72.     pop    bx
  73.     pop    ax
  74. pass_to_bios:        ;pass interrupt to normal BIOS handler
  75.     jmp    cs:[old_int10]
  76. endres:
  77. ; make scroll front end handler resident & revector interrupt 10 to it
  78. makeres:
  79.     push    cs
  80.     pop    ds
  81.     assume    ds:cseg
  82.     mov    ax,3510h    ;DOS get vector function, vector 10h
  83.     int    21h        ;get vector 10h
  84.     mov    word ptr [old_int10],bx    ;set aside old vector to
  85.     mov    word ptr [old_int10+2],es    ; allow pass to BIOS
  86.     mov    ax,2510h    ;DOS set vector function, vector 10h
  87.     mov    dx,offset scroll_front_end    ;revector interrupt
  88.     int    21h            ; 10h to front end routine
  89.     mov    dx,offset endres ;# of paragraphs to make
  90.     mov    cl,4        ; resident-can't do with an
  91.     shr    dx,cl        ; expression because assembler can't
  92.     inc    dx        ; calculate w/relocatable label
  93.     mov    ax,3100h     ;DOS make resident fn, exit code=0
  94.     int    21h        ;terminate & stay resident
  95. start    endp
  96. cseg    ends
  97.     end    start
  98.  
  99.